<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<div id="root">
        <h1>{{title}}</h1>
        <br>
        <school></school>


</div>
</body>
<script type="text/javascript">
    Vue.config.productionTip = false;

    //1.创建组件
    const student = Vue.extend({
        template: '<div><h3>学生姓名：{{name}}</h3><h3>学生年龄：{{age}}</h3></div>',
        data(){
            name: 'student'
            return {
                name: '张三',
                age: 18
            }
        }
    })

    const school  = Vue.extend({
        name:'school',
        template:'<div><h3>学校名称：{{name}}</h3><h3>学校地址：{{address}}</h3><student></student></div>',

        data(){
            return {
                name: '尚硅谷',
                address: '北京'
            }
        },
        components:{student}
    })


    new Vue({
        el: '#root',
        components:{
            school
        },
        data:{
            title:"以下是组建使用"
        },
        computed:{

        },
        methods:{

        }
    })
</script>
</html>
